package com.fhz.mvvm.repository

import android.util.Log
import androidx.lifecycle.LiveData
import com.fhz.loginmvvm.callback.ApiResponse
import com.fhz.loginmvvm.callback.ApiSuccessResponse
import com.fhz.mvvm.dataSource.local.UserLocalDataSource
import com.fhz.mvvm.dataSource.retrofit.UserRetrofitService
import com.fhz.mvvm.entity.User
import com.fhz.mvvm.entity.UserEntity
import javax.inject.Inject

/**
 * 时间:2023/3/27
 * @author Mr.Feng
 * 简述: TODO
 */
class UserRepository @Inject constructor (
    private val userLocalDataSource: UserLocalDataSource,
    private val userRetrofitService: UserRetrofitService
) {

    private  val TAG = "UserRepository"
    //登录一定是从网络请求
    fun login(name:String,pwd:String) : LiveData<ApiResponse<UserEntity>>{
        return userRetrofitService.login(name, pwd)
    }

    suspend fun insertUser(user: User){
        userLocalDataSource.insertUser(user)
    }





}